]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
WindowManager: improve destroy window animation
authorGiovanni Campagna <gcampagna@src.gnome.org>
Tue, 8 Jul 2014 09:51:49 +0000 (11:51 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Tue, 29 Jul 2014 12:55:48 +0000 (14:55 +0200)
The animation is the same for modal dialogs, but it is now
run for non modal dialogs too (matching the new behavior on
show).
In addition, we run a destroy animation for normal windows,
if they use CSD (there are technical limitations that prevent
running animations after destroy on server decorated windows)

https://bugzilla.gnome.org/show_bug.cgi?id=732857

js/ui/windowManager.js

index b9ad20f493444e9ecbcb9d19522e5ba29d1558f0..105dd487ef1b305e0688e3b61220259595c9ac27 100644 (file)
@@ -1182,40 +1182,73 @@ const WindowManager = new Lang.Class({
                                                              });
         }
 
-        if (!this._shouldAnimateActor(actor, [Meta.WindowType.MODAL_DIALOG])) {
+        let types = [Meta.WindowType.NORMAL,
+                     Meta.WindowType.DIALOG,
+                     Meta.WindowType.MODAL_DIALOG];
+        if (!this._shouldAnimateActor(actor, types)) {
             shellwm.completed_destroy(actor);
             return;
         }
 
-        this._destroying.push(actor);
-
-        if (window.is_attached_dialog()) {
-            let parent = window.get_transient_for();
-            this._checkDimming(parent, window);
+        switch (actor._windowType) {
+        case Meta.WindowType.NORMAL:
+            if (!window.is_client_decorated()) {
+                // We cannot animate the destruction of non-client
+                // decorated windows, because the frame window is
+                // repainted by the X server with the background pixmap/
+                // pixel before creating the last composite pixmap
+                // (so we animate a flat gray rectangle with a titlebar)
+                shellwm.completed_destroy(actor);
+                return;
+            }
 
-            actor.set_scale(1.0, 1.0);
             actor.set_pivot_point(0.5, 0.5);
-            actor.show();
+            this._destroying.push(actor);
 
-            actor._parentDestroyId = parent.connect('unmanaged', Lang.bind(this, function () {
-                Tweener.removeTweens(actor);
-                this._destroyWindowDone(shellwm, actor);
-            }));
+            Tweener.addTween(actor,
+                             { opacity: 0,
+                               scale_x: 0.8,
+                               scale_y: 0.8,
+                               time: DESTROY_WINDOW_ANIMATION_TIME,
+                               transition: 'easeOutQuad',
+                               onComplete: this._mapWindowDone,
+                               onCompleteScope: this,
+                               onCompleteParams: [shellwm, actor],
+                               onOverwrite: this._mapWindowOverwrite,
+                               onOverwriteScope: this,
+                               onOverwriteParams: [shellwm, actor]
+                             });
+            break;
+        case Meta.WindowType.MODAL_DIALOG:
+        case Meta.WindowType.DIALOG:
+            actor.set_pivot_point(0.5, 0.5);
+            this._destroying.push(actor);
+
+            if (window.is_attached_dialog()) {
+                let parent = window.get_transient_for();
+                this._checkDimming(parent, window);
+                actor._parentDestroyId = parent.connect('unmanaged', Lang.bind(this, function () {
+                    Tweener.removeTweens(actor);
+                    this._destroyWindowDone(shellwm, actor);
+                }));
+            }
 
             Tweener.addTween(actor,
                              { scale_y: 0,
                                time: DESTROY_WINDOW_ANIMATION_TIME,
-                               transition: "easeOutQuad",
-                               onComplete: this._destroyWindowDone,
+                               transition: 'easeOutQuad',
+                               onComplete: this._destoyWindowDone,
                                onCompleteScope: this,
                                onCompleteParams: [shellwm, actor],
                                onOverwrite: this._destroyWindowDone,
                                onOverwriteScope: this,
                                onOverwriteParams: [shellwm, actor]
                              });
+            break;
+        default:
+            shellwm.completed_destroy(actor);
             return;
         }
-        shellwm.completed_destroy(actor);
     },
 
     _destroyWindowDone : function(shellwm, actor) {